package com.noble.glamour.bean.my;


import com.noble.library.base.bean.BaseData;
import com.noble.glamour.module.logic.application.ModuleMgr;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * 索要礼物的礼物列表信息
 * Created by zm on 17/7/13.
 */
public class QunGiftIdsInfo extends BaseData {

    private List<GiftsList.GiftInfo> gift_ids = new ArrayList();            //私密照片的礼物ID列表
    private List<GiftsList.GiftInfo> gift_ids_video = new ArrayList();      //私密视频的礼物ID列表
    private List<GiftsList.GiftInfo> gift_ids_text = new ArrayList();       //私密文字/语音的礼物ID列表
    @Override
    public void parseJson(String s) {
        JSONObject jsonObject = getJsonObject(s);
        if (jsonObject.has("res")){
            jsonObject = jsonObject.optJSONObject("res");
            if (jsonObject.has("gift_ids")){
                JSONArray jsonArray = jsonObject.optJSONArray("gift_ids");
                for (int i = 0; i < jsonArray.length(); i++) {
                    GiftsList.GiftInfo info = ModuleMgr.getCommonMgr().getGiftLists().getGiftInfo(jsonArray.optInt(i));
                    gift_ids.add(info);
                }
            }
            if (jsonObject.has("gift_ids_video")){
                JSONArray jsonArray = jsonObject.optJSONArray("gift_ids_video");
                for (int i = 0; i < jsonArray.length(); i++) {
                    GiftsList.GiftInfo info = ModuleMgr.getCommonMgr().getGiftLists().getGiftInfo(jsonArray.optInt(i));
                    gift_ids_video.add(info);
                }
            }
            if (jsonObject.has("gift_ids_text")){
                JSONArray jsonArray = jsonObject.optJSONArray("gift_ids_text");
                for (int i = 0; i < jsonArray.length(); i++) {
                    GiftsList.GiftInfo info = ModuleMgr.getCommonMgr().getGiftLists().getGiftInfo(jsonArray.optInt(i));
                    gift_ids_text.add(info);
                }
            }
        }
    }

    public List getGift_ids() {
        return gift_ids;
    }

    public List getGift_ids_video() {
        return gift_ids_video;
    }

    public List getGift_ids_text() {
        return gift_ids_text;
    }
}
